package logic

import (
	"context"
	"user_srv/internal/dao"

	"user_srv/internal/svc"
	"user_srv/user"

	"github.com/zeromicro/go-zero/core/logx"
)

type UserUpdateLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewUserUpdateLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UserUpdateLogic {
	return &UserUpdateLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

func (l *UserUpdateLogic) UserUpdate(in *user.UserUpdateRequest) (*user.UserUpdateResponse, error) {
	// todo: add your logic here and delete this line
	update, err := dao.UserUpdate(in)
	if err != nil {
		return nil, err
	}
	return &user.UserUpdateResponse{
		Id: int64(update.Id),
	}, nil
}
